package com.ada.common.util;

import java.util.Collection;
import java.util.Map;

/**
 */
public class CollectionUtil {
	/**
	 * 断集合是否为null或者为空
	 */
	public static boolean isEmptyOrNull(Collection c) {
		return c == null || c.isEmpty();
	}

	/**判断Map是否为空*/
	public static boolean isEmptyOrNull(Map map){
		return map == null || map.isEmpty();
	}

	public static <T> boolean isEmptyOrNull(T[] array) {
		return array == null || array.length == 0;
	}

	public static int getSize(Collection c) {
		return c == null ? 0 : c.size();
	}

	public static int getSize(Map map) {
		return map == null ? 0 : map.size();
	}

	public static <T> int getSize(T[] array) {
		return array == null ? 0 : array.length;
	}
}
